package com.myteam.fugaocrm.sqldb.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.myteam.fugaocrm.modle.FgCompany;

/**
 * 公司Mapper
 * @author BZX
 */
public interface FgCompanyMapper {
	/** 查询全部公司 */
	@Select("select * from fg_company where is_delete = 0")
	public List<FgCompany> all();
	
	/** 删除一个公司 */
	@Select("update fg_company set is_delete = 1 where company_id = #{companyId}")
	public void deleteOne(@Param("companyId") Integer companyId);
	
	/** 新增一个公司 */
	@Select("insert into fg_company(company_code, company_name,created_date,modified_date,created_user,modified_user) values(#{companyCode},#{companyName},#{createdDate},#{modifiedDate},#{createdUser},#{modifiedUser})")
	public void insert(Map<String, Object> params);
	
	/** 修改一个公司 */
	@Select("update fg_company set company_code=#{companyCode},company_name=#{companyName},modified_user=#{modifiedUser},modified_date=#{modifiedDate} where company_id = #{companyId}")
	public void update(Map<String, Object> params);
	
	/** 根据ID查询公司 */
	@Select("SELECT * FROM fg_company WHERE company_id = #{companyId}")
	public FgCompany selectById(@Param("companyId") Integer companyId);
	
}
